package com.chunuo.eduservice.controller;

import com.chunuo.commonutils.R;
import com.chunuo.eduservice.entity.vo.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * 类的作用
 *
 * @author liujiamiao
 * @email 2544296058@qq.com
 * @date 2020-07-05 10:44
 */
@RestController
@Slf4j
@RequestMapping("/eduservice/user")
//@CrossOrigin
public class UserController {

    @PostMapping("login")
    public R user(@RequestBody User user){
        log.info("user = {}",user);
        return R.ok().data("token","token");
    }

    @GetMapping("info")
    public R getInfo(@RequestParam("token") String token){
        log.info("token = {}",token);
        String[] roles = {"admin","user"};
        return R.ok().data("roles",roles).data("name","admin").data("avatar","http://up.enterdesk.com/edpic/de/67/ac/de67acb91e02a3121e3974c0177f8bf2.jpg");
    }

}
